/*
* $Id: config.h,v 1.60 2008/01/16 07:50:14 sunny Exp $
*/
/*******************************************************************************

       UBEC (Uniband Electronic Corp.)

       Project: U-NET01, Ubiquitous network platform

       File: config.h

       Version: 0.3.0

       Usage:  System configuration

       Platform: U-NET01 DK with Keil 8051 C compiler

       Reference:

               Silicon Laboratories: C8051F124, C8051F340

               UBEC: UZ2400, UZ2410

       Note :

               Copyright (C) 2007 Uniband Electronic Corporation, All rights reserved

********************************************************************************/

#ifndef	__CONFIG_H__
#define	__CONFIG_H__

#define	DEBUG_MODE		0	// 2007/2/11 22:53:58, Sunny: 1:enable/0:disable debug mode
#define DEBUG_FUNC		0	// 2007/10/17 Chunchia: 1:enable/0:disable debug function

#define	UNET01			1	// 2007/6/26 11:31, Sunny: 0 for non-UNET01 code

#define	UNET01_VERSION		"UNET01 v0.3.0"

//#define TURBO
//#define CHECKSUM
#define USE_BEACON_LIST		0
#define USE_DENIER_LIST		1
#define MAX_DENY_COUNT		10
#define TIMER_1MS
//#define TX_ASO_RSP_FAILURE

#if UNET01
// 2007/11/2 17:10, Sunny: My_MAC_Address[7..4] defined in config_xxxx.h
#define	My_MAC_Address3		0x00	// 2007/7/2 12:41, Sunny: the byte 3 of MAC address,
#define	My_MAC_Address2		0x00	// 2007/7/2 12:41, Sunny: the byte 2 of MAC address,
#define	My_MAC_Address1		0x04	// 2007/7/2 12:41, Sunny: the byte 1 of MAC address,
#define	My_MAC_Address0		0x10	// 2007/7/2 12:41, Sunny: the LSB byte (byte 0) of MAC address,

#if 1	// 1: build object code for coordinator
	// 0: build object code for router
	#define I_Am_Coordinator	// enable the coordinator functions.
#endif

//Unet Parameters
#if 1 // 1: Use specified RF Channel and PAN ID.
	// 0: Auto select RF channel and PAND ID.
	#define UNET_PAN_ID		0x1122	// Range: 0x0000 to 0x3FFF
	#define UNET_CHANNEL		21	// Range: 11 to 26
#else
	#define UNET_PAN_ID		0xffff	// Auto search
	#define UNET_CHANNEL		0xff	// Auto search
#endif
#define UNET_MAX_CHILD			5	// Range: 1 to 32
#define UNET_MAX_ROUTER			5	// Range: 0 to UNET_MAX_CHILD
#define UNET_MAX_DEPTH			4	// Range: 2 to 7
#define UNET_POLL_INTERVAL		10000	// unit: ms, (if 0, disable polling)

#define UNET_SCAN_WAIT_TIME		900
#define UNET_COORD_ADDRESS		0x0000
#define UNET_MAX_RETRY			3
#define UNET_MAX_BROCAST_EXPIRE		1

#endif // #if UNET01

/*
In a big-endian system, the most significant value in the sequence is stored at the lowest storage address (i.e., first).
In a little-endian system, the least significant value in the sequence is stored first.
*/

#if defined(__K0__)				// NEC C compiler for 78K0
	#define __LOC__

	#define	BIGENDIAN	0		// This is a little endian type CPU.
	#define DATA_BUS_WIDTH	8		// This is a 8-bit CPU.
	#define REENTRANT
	#include "config_nec78k0.h"

#elif defined(__C51__)				// Keil C51
	#define __LOC__

	#define	BIGENDIAN	1		// This is a big endian type CPU.
	#define DATA_BUS_WIDTH	8		// This is a 8-bit CPU.
	#define REENTRANT	reentrant	// compiler key-words for recursive functions
	#include "config_8051.h"

#elif defined(__ICC430__)			// MSP430 IAR C/C++ Compiler
	#define __STR2__(x) #x
	#define __STR1__(x) __STR2__(x)
	#define __LOC__ __FILE__ "("__STR1__(__LINE__)") : "
	// Usage:
	//	#pragma message(__LOC__ "important part to be changed")

	#define	BIGENDIAN	0		// This is a little endian type CPU.
	#define DATA_BUS_WIDTH	16		// This is a 16-bit CPU.
	#define REENTRANT
	#include "config_msp430.h"

#else
        #error "Unknown Compiler."
#endif

#ifdef CONSOLE
	#define DATAOUT
#endif

#if DEBUG_MODE && !defined(CONSOLE)
	#pragma message(__LOC__ "CONSOLE not defined for debug message output.")
	#undef DEBUG_MODE
	#define DEBUG_MODE		0
#endif

#if defined(I_Am_Coordinator) && USE_DENIER_LIST
	//#pragma message(__LOC__ "'USE_DENIER_LIST' is not suitable on coordinator.")
	#undef USE_DENIER_LIST
	#define USE_DENIER_LIST		0
#endif

#endif // #ifndef	__CONFIG_H__
